package com.xiashitech.agent.instrumentation.template.inst;

import com.google.auto.service.AutoService;
import com.xiashitech.agent.instrumentation.base.InstHelper;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties;

import java.util.Arrays;
import java.util.List;

/**
 * 插桩模块
 */
@AutoService(InstrumentationModule.class)
public class TemplateInstrumentationModule extends InstrumentationModule {

    public TemplateInstrumentationModule() {
        super("xs-template");
    }

    @Override
    public boolean defaultEnabled(ConfigProperties config) {
        return false; //演示代码，不开启插桩模块
    }

    @Override
    public List<TypeInstrumentation> typeInstrumentations() {
        return Arrays.asList(new TemplateInstrumentation());
    }

    @Override
    public List<String> getAdditionalHelperClassNames() {
        return InstHelper.getHelperClasses(true,
                "com.xiashitech.agent.instrumentation.template.TemplateProcessor",
                "com.xiashitech.agent.instrumentation.template.TemplateRequestData",
                "com.xiashitech.agent.instrumentation.template.TemplateSingletons");
    }

}
